﻿using University.Workshop.Business;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using University.Workshop.DataAccess;
using System.Collections.ObjectModel;

namespace University.Workshop.Tests
{
    
    
    /// <summary>
    ///This is a test class for LevelsManagerTest and is intended
    ///to contain all LevelsManagerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class LevelsManagerTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for LevelUp
        ///</summary>
        [TestMethod()]
        public void LevelUpTest()
        {
            LevelsManager target = new LevelsManager(); // TODO: Initialize to an appropriate value
            LevelDatabase level2 = new LevelDatabase();
            LevelDatabase level3 = new LevelDatabase();
            LevelDatabase level4 = new LevelDatabase();
            LevelDatabase level5 = new LevelDatabase();
            LevelDatabase level6 = new LevelDatabase();
            Collection<LevelDatabase> levels = new Collection<LevelDatabase>();
            levels.Add(level2);
            levels.Add(level3);
            levels.Add(level4);
            levels.Add(level5);
            levels.Add(level6);
            level2.Chips = 30000;
            level3.Chips = 40000;
            level4.Chips = 60000;
            level5.Chips = 80000;
            level6.Chips = 120000;
            level2.Level = 2;
            level3.Level = 3;
            level4.Level = 4;
            level5.Level = 5;
            level6.Level = 6;
            level2.TimeWon = 10;
            level3.TimeWon = 22;
            level4.TimeWon = 35;
            level5.TimeWon = 60;
            level6.TimeWon = 100;
            target.SetLevels(levels);
            User user = new User(); // TODO: Initialize to an appropriate value
            user.Chips=40000;
            user.UserLevel=1;
            user.TimeWon = 11;
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.LevelUp(user);
            Assert.AreEqual(expected, actual);
            
        }
    }
}
